﻿namespace TestNewGuiFramework
{
    using System.Threading;
    using GHI.Hardware.G120;
    using Pps.Core;
    using Pps.Gui;
    using Pps.Gui.Lcd;

    public class Program
    {
        internal static OverviewWindow Overview = new OverviewWindow();
        internal static HeatingWindow Heating = new HeatingWindow();
        internal static HeatpumpWindow Heatpump = new HeatpumpWindow();
        internal static TemperatureWindow Temperature = new TemperatureWindow();

        private CP7 display;

        public Program()
        {
            this.display = new CP7(Pin.P0_25, Pin.P1_19);
            this.display.SetBacklightAutoTurnOff(30000);
            this.display.HomePressed += display_HomePressed;
            this.display.BacklightOff += display_BacklightOff;

            WindowManager.Display = this.display;

            WindowManager.ChangeToWindow(Program.Overview);
        }

        private void display_BacklightOff()
        {
            WindowManager.ChangeToWindow(Program.Overview);
        }

        private void display_HomePressed(TouchId finger)
        {
            WindowManager.ChangeToWindow(Program.Overview);
        }

        public static void Main()
        {
            Program p = new Program();

            Thread.Sleep(Timeout.Infinite);
        }
    }
}